﻿using DataProcessor;
using System.Data.Common;

var path = Console.ReadLine();
var dataReader = new DataReader(new(path!));

foreach (int sample in new[] { 1, 2 })
{
    foreach (int frequency in new[] { 50, 100 })
    {
        var data = dataReader.Read(sample, frequency, division: 4);

        var yBs = (data.Max(point => point.Ch2) - data.Min(point => point.Ch2)) / 2;

        var yBr = data
            .Where(point => Math.Abs(point.Ch1) < 1e-6)
            .Average(point => Math.Abs(point.Ch2));

        var xHe = data
            .Where(point => Math.Abs(point.Ch2) < 1e-6)
            .Average(point => Math.Abs(point.Ch1));

        Console.WriteLine($"sample{sample}-{frequency}Hz: {yBs} {yBr} {xHe}");
    }
}
